k = hs.hotkey.modal.new("cmd-shift", "k")
-- function k:entered()
-- 	hs.alert("Entered mode")
-- end
-- function k:exited()
-- 	hs.alert("Exited mode")
-- end
k:bind("", "escape", function()
	k:exit()
end)
-- k:bind("", "J", "Pressed J", function()
-- 	print("let the record show that J was pressed")
-- end)
-- k:bind("", "o", function()
-- 	-- 3 space,layout
-- 	while #hs.spaces.spacesForScreen() < 3 do
-- 		hs.spaces.addSpaceToScreen()
-- 	end
-- 	k:exit()
-- end)

while #hs.spaces.spacesForScreen() < 3 do
	hs.spaces.addSpaceToScreen()
end
k:bind("", "l", function()
	-- last one
	hs.spaces.gotoSpace(hs.spaces.spacesForScreen()[#hs.spaces.spacesForScreen()])
	k:exit()
end)
k:bind("", "h", function()
	-- first one
	hs.spaces.gotoSpace(hs.spaces.spacesForScreen()[1])
	k:exit()
end)
k:bind("", "1", function()
	-- first one
	hs.spaces.gotoSpace(hs.spaces.spacesForScreen()[1])
	k:exit()
end)
k:bind("", "2", function()
	hs.spaces.gotoSpace(hs.spaces.spacesForScreen()[2])
	k:exit()
end)
k:bind("", "3", function()
	hs.spaces.gotoSpace(hs.spaces.spacesForScreen()[3])
	k:exit()
end)
k:bind("", "s", function()
	hs.spaces.moveWindowToSpace(hs.window.focusedWindow(), hs.spaces.spacesForScreen()[2])
	k:exit()
end)
